﻿using Grow.GuidGenerator.CreateGuidGenerator;
using Grow.Module.Options;
using Grow.Module.Service;

namespace Grow.GuidGenerator.Sequential.CreateGuidGenerator
{
    public class CreateGuidGeneratorBuilder : ICreateGuidGeneratorBuilder
    {
        private readonly IServiceContainer _serviceContainer;

        public CreateGuidGeneratorBuilder(IServiceContainer serviceContainer)
        {
            _serviceContainer = serviceContainer;
        }

        public ICreateGuidGeneratorBuilder AddGuidGeneratorOptions(Action<IOptionsBind, GuidGeneratorOptions> guidGeneratorOptionsAction)
        {
            _serviceContainer.OptionsManager.AddOptions<GuidGeneratorOptions>(a =>
            {
                guidGeneratorOptionsAction(_serviceContainer.OptionsManager.GetOptionsBind(), a);
            });
            return this;
        }
    }
}
